package cn.zyq.ykb.controller.h5.product;

import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.beans.product.Product;
import cn.zyq.ykb.service.product.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.zyq.ykb.system.common.PageParam;

/**
 * 商品Controller
 *
 * @author SystemAuth
 * @date 2023-11-02
 */

@RestController(value = "H5ProductController")
@RequestMapping("/api/product")
@Api(tags = "商品接口")
public class ProductController extends BaseController {

    @Autowired
    private ProductService productService;

    /**
     * 查询商品列表
     */
    @ApiOperation(value = "列表", response = Product.class)
    @PostMapping("/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.productService.selectProductList(pageParam,this.getLoginUser());
    }

    /**
     * 获取商品详细信息
     */
    @ApiOperation(value = "详情", response = Product.class)
    @GetMapping(value = "/{productID}")
    public Object getInfo(@PathVariable("productID") Integer productID) {
        return this.productService.selectProductByProductIDH5(productID,this.getLoginUser());
    }

}
